package mth.rmclusterer;

public class FileGroup {
	/*
	 * Eine FileGroup verwaltet die eine masterImp Lösung und deren Parameter. Die Member
	 * stellen die 10 Clusterergebnisse zu einer masterImp Lösung dar.
	 */
	private String[] member;
	private String qValue;
	private String distMeasure;
	private String kValue;
	private String realQValue;
	private String nQValue;
	private String pairCount;
	
	FileGroup() {
		member = new String[0];
		qValue="";
		distMeasure="";
		kValue="";
		realQValue="";
		nQValue="";
		pairCount="";
	}
	
	FileGroup(String qVal, String dMes, String kV, String realQVal, String nQVal, String pairC) {
		member = new String[0];
		qValue=qVal;
		distMeasure=dMes;
		kValue=kV;
		realQValue=realQVal;
		nQValue=nQVal;
		pairCount=pairC;
	}
	
	public String[] getMember()	 {
		return member;
	}
	
	public void setMember(String[] m) {
		member=m;
	}
	
	public String getKValue() {
		if (kValue.equals("") && member.length != 0) {
			kValue=member[0].split("_")[4];
		}
		return kValue;
	}
	
	public String getQValue() {
		if (qValue.equals("") && member.length != 0) {
			qValue=member[0].split("_")[2];
		}
		return qValue;
	}
	
	public String getDistMeasure() {
		if (distMeasure.equals("") && member.length != 0) {
			distMeasure=member[0].split("_")[7];
		}
		return distMeasure;
	}
	
	public String getRealQValue() {
		if (realQValue.equals("") && member.length != 0) {
			realQValue=member[0].split("_")[9];
		}
		return realQValue;
	}
	
	public String getNQValue() {
		if (nQValue.equals("") && member.length != 0) {
			nQValue=member[0].split("_")[13];
		}
		return nQValue;
	}
	
	public String getPairCount() {
		if (pairCount.equals("") && member.length != 0) {
			pairCount=member[0].split("_")[11];
		}
		return pairCount;
	}
	
	public FileGroup[] addFileGroupToArray(FileGroup[] array, FileGroup val) {
		if (array==null || array.length==0) 
			array = new FileGroup[0];
		FileGroup[] helper = new FileGroup[array.length+1];
		for (int a=0; a<array.length; a++) {
			helper[a]=array[a];
		}
		helper[array.length] = val;
		array = new FileGroup[helper.length];
		array=helper;
		return array;
	}
	
	public boolean fileGroupContains(String val) {
		if (member==null || member.length==0) 
			return false;
		for (int a=0; a<member.length; a++) {
			if (member[a].equals(val))
				return true;
		}
		return false;
	}
}
